<html><head><title>Web Socket Test</title></head>
<body>
<script type="text/javascript">
var socket;
if (window.WebSocket) {
  socket = new WebSocket("ws://localhost:8015/ws");
  socket.onmessage = function(event) { alrt(event.data); };
  socket.onopen = function(event) { alrt("Web Socket opened!"); };
  socket.onclose = function(event) { alrt("Web Socket closed."); };
} else {
  alert("Your browser does not support Web Socket.");
}

function alrt(message)
{
	document.getElementById('log').innerHTML  =  message + "<br>" + document.getElementById('log').innerHTML  ;

}

function send(message) {
  if (!window.WebSocket) { return; }
  if (socket.readyState == WebSocket.OPEN) {
    socket.send(message);
  } else {
    alert("The socket is not open.");
  }
}
</script>
<form onsubmit="return false;">
<textarea name="message" cols="60" rows="15"/>["LOGIN",{"login":"test","password":"test"}]</textarea><br><input type="button" value="Send Web Socket Data" onclick="send(this.form.message.value)" />
</form>

<div id="log">
</div>
</body>
</html>
